import axios from 'axios';

const instance = axios.create({
  //   baseURL: '/api'
})

instance.interceptors.request.use(function (config) {
  let userinfo = localStorage.getItem('userinfo')
  try {
    userinfo = JSON.parse(userinfo) || {}
  } catch (err) {
    userinfo = {}
  }
  if (userinfo.authorization) config.headers.authorization = userinfo.authorization
  return config;
}, function (error) {
  return Promise.reject(error);
});
export default instance;